/**业务code */
export const WorkCode = 1212

const getCode = (code: number) => +`${WorkCode}6${code}`
/**
 * @description: 请求结果集
 */
export enum ResultEnum {
  SUCCESS = getCode(200),
  ERROR = getCode(400),
  UNAUTHORIZED = getCode(401),

  /**账号不存在 */
  ACCOUNT_NOT_EXIST = getCode(602),
  /**账号已被禁用 */
  ACCOUNT_DISABLED = getCode(603),
  ACCOUNTNOTEXIST = getCode(708), // 账号不存在
  ACCOUNTDISABLED = getCode(709), // 账号已被禁用

  /**密码错误 */
  WRONG_PASSWORD = getCode(604),
  /**密码错误次数达到上限，请24小时后再试 */
  PASSWORD_LOCK = getCode(605),
  /**旧密码错误 */
  WRONG_OLD_PASSWORD = getCode(606),
  /**新密码不能与旧密码相同 */
  WRONG_COMMON_PASSWORD = getCode(607),
  /**密码连续错误4次 */
  ERR_PASSWORD_FOUR = getCode(608),
  /**密码连续错误4次 */
  ERR_PASSWORD_FIVE = getCode(609),
  CODEERROR = getCode(733), // 验证码错误
  CODFIVEEERROR = getCode(726), // 验证码错误
  WRONGPASSWORD = getCode(711), // 密码错误
  PASSWORDLOCK = getCode(727), // 密码错误次数达到上限，请24小时后再试
  WRONGOLDPASSWORD = getCode(715), // 旧密码错误
  WRONGCOMMONPASSWORD = getCode(714), // 新密码不能与旧密码相同
  ERRPASSWORDFOUR = getCode(728), // 密码连续错误4次，再错误2次账号将被冻结24小时
  ERRPASSWORDFIVE = getCode(729) // 密码连续错误5次,再错误1次账号将被冻结24小时
}

// http://wiki.test.com/pages/viewpage.action?pageId=20515120
export const accountErrorMap = [
  getCode(601),
  // getCode(602),
  getCode(603)
]

export const passwordErrorMap = [
  getCode(604),
  getCode(605),
  getCode(608),
  getCode(609)
]

/**
 * @description: 请求方式
 */
export enum RequestEnum {
  GET = 'GET',
  POST = 'POST',
  PUT = 'PUT',
  DELETE = 'DELETE'
}

/**
 * @description:  headers contentType
 */
export enum ContentTypeEnum {
  // json
  JSON = 'application/json;charset=UTF-8',
  // form-data qs
  FORM_URLENCODED = 'application/x-www-form-urlencoded;charset=UTF-8',
  // form-data  upload
  FORM_DATA = 'multipart/form-data;charset=UTF-8'
}
